<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  layout:decorator="layouts/layout" th:with="header='编辑物料', subtext='编辑指定物料数据'">

<head>
	<title>编辑物料</title>
</head>
<body>
	<th:block layout:fragment="content">
		<div class="box">
			<div class="box-body">
				<form id="materialForm" name="materialForm" th:object="${m}" th:action="@{|${baseUrl}/save${m.id==null?'':'/' + m.id}|}" method="post" class="form-horizontal" novalidate="novalidate">
					<input id="id" type="hidden" name="id" th:field="*{id}" />
					<input id="version" type="hidden" name="version" th:field="*{version}" />
					<div class="row line">
						<div class="col-lg-6">
							<h3 class="page-header">基本设置</h3>
						</div>
					</div>
					
                  			<div class="row">
								<div class="col-sm-6">
									<div class="form-group">
										<label class="control-label col-sm-3 mg-top-6 required">物料代码</label>
										<div class="col-sm-8 form-control-static">
											<input id="code" name="code" th:value="*{code}" maxlength="20" th:readonly="${not m.new}" class="form-control required" />
										</div>
									</div>
								</div>
						   </div>		
                  			<div class="row">
								<div class="col-sm-6">
									<div class="form-group">
										<label class="control-label col-sm-3 mg-top-6 ">物料名称</label>
										<div class="col-sm-8 form-control-static required">
											<input id="name" name="name" th:value="*{name}" maxlength="120" class="form-control required" />
										</div>
									</div>
								</div>
						   </div>		
                  			<div class="row">
								<div class="col-sm-6">
						            <div class="form-group">
						              <label class="control-label col-sm-3 mg-top-6 ">物料类型</label>
						              <div class="col-sm-8 form-control-stati">
						                <select name="type" id="type" th:field="*{type}" class="form-control required">
						                  <option value="">请选择</option>
						                  <option th:each="a : ${@CODES.findByType('MATERIAL_TYPE')}" th:value="${a.value}" th:text="${a.name}" />
						                </select>
						              </div>
								  </div>
				               </div>
				            </div>
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label class="control-label col-sm-3 mg-top-6 ">规格型号</label>
                                        <div class="col-sm-8 form-control-static required">
                                            <input id="specModel" name="specModel" th:value="*{specModel}" maxlength="120" class="form-control" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label class="control-label col-lg-3">码盘数量</label>
                                        <div class="col-lg-8">
                                            <input id="udf09" name="udf09" type="number"  min="0" max="9999999999999" th:value="*{udf09}" class="form-control" />
                                        </div>
                                    </div>
                                </div>
                            </div>
							<div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label class="control-label col-lg-3">上架规则</label>
                                        <div class="col-lg-8">
                                            <select id="paruleId" name="paruleId" class="form-control">
                                                <option th:value="${m.parule != null ? m.parule.id : ''}" th:selected="${m.parule != null ? true : ''}">[[${m.parule != null ? m.parule.name : '请选择'}]]</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                  			<div class="row">
								<div class="col-sm-6">
								   <div class="form-group">
										<label class="control-label col-lg-3">重量</label>
										<div class="col-lg-8">
											<input id="materialGrossweight" name="materialGrossweight" type="number"  min="0" max="9999999999999" th:value="*{materialGrossweight}" class="form-control" />
										</div>
									</div>
								</div>
							</div>
                  			<div class="row">
								<div class="col-sm-6">
								   <div class="form-group">
										<label class="control-label col-lg-3">安全库存</label>
										<div class="col-lg-8">
											<input id="storageMinQty" name="storageMinQty" type="number"  min="0" max="9999999999999" th:value="*{storageMinQty}" class="form-control" />
										</div>
									</div>
								</div>
							</div>
							<div class="row">
								<div class="col-sm-6">
									<div class="form-group">
										<label class="control-label col-lg-3">解析时间</label>
										<div class="col-lg-8">
											<input id="shelflifeDays" name="shelflifeDays" type="number"  min="0" max="9999999999999" th:value="*{shelflifeDays}" class="form-control" />
										</div>
									</div>
								</div>
							</div>
                  			<div class="row">
								<div class="col-sm-6">
									<div class="form-group">
										<label class="control-label col-sm-3 mg-top-6 ">物料组</label>
										<div class="col-sm-8 form-control-static">
											<input id="groupCode" name="groupCode" th:value="*{groupCode}" maxlength="20"
											class="form-control" />
										</div>
									</div>
								</div>
						   </div>	
						    <div class="row">
								<div class="col-sm-6">
									<div class="form-group">
										<div class="col-lg-offset-3 col-lg-9 form-control-static" style="margin-left: 25%;">
											<div class="checkbox">
												<input id="enabled" name="enabled" type="checkbox"
												th:checked="*{enabled}" /> <label for="enabled">激活</label>
											</div>
										</div>
									</div>
								</div>
					  	    </div>
					  	    <div class="hr-line-dashed"></div>
							<div class="form-group">
								<div class="text-center">
									<a class="btn btn-default " th:href="@{|${baseUrl}|}"> 
									    <i class="fa fa-fw fa-reply"></i> 返回
									</a>
									<button type="submit" class="btn btn-primary">
										<i class="fa fa-fw  fa-save"></i> 保存
									</button>
								</div>
							</div>	
				</form>
			</div>
		</div>
	</th:block>
	<th:block layout:fragment="scripts">
		<script th:replace="layouts/fragments/validatejs :: validate"></script>
		<script th:inline="javascript">
	  	  // 后端传入前端使用的变量JS中定义
	      var oldCode = /*[[${m.code}]]*/'';
	      var oldName = /*[[${m.name}]]*/'';
	    </script>
		<script th:src="@{|${theme}/js/app/master/material_form.js?v=${applicationVersion}|}" th:inline="javascript"></script>
	</th:block>
</body>

</html>